<template>
	<div>
		{{ showTitle }}分佣：
		<span v-if="isShow"> {{ memberName }} ￥{{ showFenxiaoMoney() }} </span>
		<span v-else>-</span>
	</div>
</template>

<script>
export default {
	name: "fenxiao-order-money-info-box",
	components: {},
	props: {
		orderSubRow: {
			type: Object,
			default: () => {}
		},
		levelNum: {
			type: Number,
			default: () => 1
		}
	},
	data() {
		return {
			dialogVisible: false
		};
	},
	computed: {
		isShow() {
			return this.orderSubRow[this.numToText(this.levelNum) + "_fenxiao_user_id"] > 0;
		},
		memberName() {
			return this.orderSubRow[this.numToText(this.levelNum) + "_fenxiao_user_name"];
		},
		showTitle() {
			return this.numToTitle(this.levelNum);
		}
	},
	methods: {
		numToText(_num) {
			switch (_num) {
				case 1:
					return "one";
				case 2:
					return "two";
				default:
					return "three";
			}
		},
		numToTitle(_num) {
			switch (_num) {
				case 1:
					return "自购";
				case 2:
					return "一级";
				default:
					return "二级";
			}
		},
		showFenxiaoMoney() {
			return (
				(this.orderSubRow.fo_paid *
					this.orderSubRow[this.numToText(this.levelNum) + "_rate"]) /
				10000000
			).toFixed(2);
		}
	}
};
</script>

<style scoped lang="scss"></style>
